var wpforms=window.wpforms||function(s,l,d){const p={cache:{},isUpdatingToken:!1,init(){d(p.ready),d(l).on("load",function(){"function"==typeof d.ready.then?d.ready.then(p.load):p.load()}),p.bindUIActions(),p.bindOptinMonster()},ready(){p.clearUrlQuery(),p.setUserIdentifier(),p.loadValidation(),p.loadDatePicker(),p.loadTimePicker(),p.loadInputMask(),p.loadSmartPhoneField(),p.loadPayments(),p.loadMailcheck(),p.loadChoicesJS(),p.initTokenUpdater(),p.restoreSubmitButtonOnEventPersisted(),p.bindSmartPhoneField(),p.bindChoicesJS(),d(".wpforms-randomize").each(function(){for(var e=d(this),t=e.children();t.length;)e.append(t.splice(Math.floor(Math.random()*t.length),1)[0])}),d(".wpforms-page-button").prop("disabled",!1),d(s).trigger("wpformsReady"),d(".wpforms-smart-phone-field").each(function(){var e=d(this);p.fixPhoneFieldSnippets(e)})},load(){},clearUrlQuery(){var e=l.location;let t=e.search;-1!==t.indexOf("wpforms_form_id=")&&(t=t.replace(/([&?]wpforms_form_id=[0-9]*$|wpforms_form_id=[0-9]*&|[?&]wpforms_form_id=[0-9]*(?=#))/,""),history.replaceState({},null,e.origin+e.pathname+t))},loadValidation(){void 0!==d.fn.validate&&(d(".wpforms-input-temp-name").each(function(e,t){var r=Math.floor(9999*Math.random())+1;d(this).attr("name","wpf-temp-"+r)}),d(s).on("change",".wpforms-validate input[type=url]",function(){var e=d(this).val();if(!e)return!1;"http://"!==e.substr(0,7)&&"https://"!==e.substr(0,8)&&d(this).val("https://"+e)}),d.validator.messages.required=wpforms_settings.val_required,d.validator.messages.url=wpforms_settings.val_url,d.validator.messages.email=wpforms_settings.val_email,d.validator.messages.number=wpforms_settings.val_number,void 0!==d.fn.payment&&d.validator.addMethod("creditcard",function(e,t){e=d.payment.validateCardNumber(e);return this.optional(t)||e},wpforms_settings.val_creditcard),d.validator.addMethod("extension",function(e,t,r){return r="string"==typeof r?r.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(t)||e.match(new RegExp("\\.("+r+")$","i"))},wpforms_settings.val_fileextension),d.validator.addMethod("maxsize",function(e,t,r){var a=r,r=this.optional(t);let o,i;if(r)return r;if(t.files&&t.files.length)for(o=0,i=t.files.length;oa)return!1;return!0},wpforms_settings.val_filesize),d.validator.addMethod("step",function(e,t,r){i=r;const a=Math.floor(i)!==i&&i.toString().split(".")[1].length||0;function o(e){return Math.round(e*Math.pow(10,a))}var i=o(d(t).attr("min"));return e=o(e)-i,this.optional(t)||o(e)%o(r)==0}),d.validator.methods.email=function(e,t){return this.optional(t)||function(e){if("string"!=typeof e)return!1;var t=e.indexOf("@",1);if(e.length<6||254=Number(r.data("password-strength-level"))},wpforms_settings.val_password_strength),d(".wpforms-validate").each(function(){var e=d(this),t=e.data("formid");let r;r=void 0!==l["wpforms_"+t]&&l["wpforms_"+t].hasOwnProperty("validate")?l["wpforms_"+t].validate:"undefined"!=typeof wpforms_validate?wpforms_validate:{errorElement:p.isModernMarkupEnabled()?"em":"label",errorClass:"wpforms-error",validClass:"wpforms-valid",ignore:":hidden:not(textarea.wp-editor-area), .wpforms-conditional-hide textarea.wp-editor-area",ignoreTitle:!0,errorPlacement(e,t){p.isLikertScaleField(t)?(t.closest("table").hasClass("single-row")?t.closest(".wpforms-field"):t.closest("tr").find("th")).append(e):p.isWrappedField(t)?t.closest(".wpforms-field").append(e):p.isDateTimeField(t)?p.dateTimeErrorPlacement(t,e):p.isFieldInColumn(t)||p.isFieldHasHint(t)?t.parent().append(e):p.isLeadFormsSelect(t)?t.parent().parent().append(e):t.hasClass("wp-editor-area")?t.parent().parent().parent().append(e):e.insertAfter(t),p.isModernMarkupEnabled()&&e.attr({role:"alert","aria-label":wpforms_settings.errorMessagePrefix,for:""})},highlight(e,t,r){var a=d(e),o=a.closest(".wpforms-field"),i=a.attr("name");("radio"===a.attr("type")||"checkbox"===a.attr("type")?o.find('input[name="'+i+'"]'):a).addClass(t).removeClass(r),"password"===a.attr("type")&&""===a.val().trim()&&l.WPFormsPasswordField&&a.data("rule-password-strength")&&a.hasClass("wpforms-field-required")&&WPFormsPasswordField.passwordStrength("",e),o.addClass("wpforms-has-error")},unhighlight(e,t,r){var e=d(e),a=e.closest(".wpforms-field"),o=e.attr("name");("radio"===e.attr("type")||"checkbox"===e.attr("type")?a.find('input[name="'+o+'"]'):e).addClass(r).removeClass(t),a.find(":input.wpforms-error,[data-dz-errormessage]:not(:empty)").length||a.removeClass("wpforms-has-error"),p.isModernMarkupEnabled()&&e.parent().find("em.wpforms-error").remove()},submitHandler(s){function n(e,t){let r="label",a="";p.isModernMarkupEnabled()&&(r="em",a='role="alert"');var o=`<${r} id="wpforms-field_recaptcha-error" class="wpforms-error" ${a}> ${wpforms_settings.val_recaptcha_fail_msg}`;e.find(".wpforms-recaptcha-container").append(o),p.restoreSubmitButton(e,t)}function e(){const e=d(s),t=e.closest(".wpforms-container"),r=e.find(".wpforms-submit"),a=r.data("captchaInvalid"),o=r.data("alt-text"),i=r.get(0).recaptchaID;return e.data("token")&&0===d(".wpforms-token",e).length&&d('').val(e.data("token")).appendTo(e),e.find("#wpforms-field_recaptcha-error").remove(),r.prop("disabled",!0),WPFormsUtils.triggerEvent(e,"wpformsFormSubmitButtonDisable",[e,r]),o&&r.text(o),a?n(e,t):p.empty(i)&&0!==i?(d(".wpforms-input-temp-name").removeAttr("name"),void p.formSubmit(e)):(grecaptcha.execute(i).then(null,function(){grecaptcha.getResponse()||n(e,t)}),!1)}return"function"==typeof wpformsRecaptchaV3Execute?wpformsRecaptchaV3Execute(e):e()},invalidHandler(e,t){void 0!==t.errorList[0]&&p.scrollToError(d(t.errorList[0].element))},onkeyup:WPFormsUtils.debounce(function(e,t){d(e).hasClass("wpforms-novalidate-onkeyup")||9===t.which&&""===this.elementValue(e)||-1!==d.inArray(t.keyCode,[16,17,18,20,35,36,37,38,39,40,45,144,225])||(e.name in this.submitted||e.name in this.invalid)&&this.element(e)},1e3),onfocusout:function(e){let t=!1;d(e).hasClass("wpforms-novalidate-onkeyup")&&!e.value&&(t=!0),this.checkable(e)||!(e.name in this.submitted)&&this.optional(e)||(t=!0),(t=d(e).data("server-error")?!1:t)&&this.element(e)},onclick(e){let t=!1;var r=(e||{}).type;let a=d(e);-1<["checkbox","radio"].indexOf(r)&&((a=a.hasClass("wpforms-likert-scale-option")?a.closest("tr"):a.closest(".wpforms-field")).find("label.wpforms-error, em.wpforms-error").remove(),t=!0),t&&this.element(e)}},e.validate(r)}))},restrictedEmailRequest(r,a){var e=d(r),t=e.closest("form");const o=t.data("validator"),i=t.data("formid");t=e.closest(".wpforms-field").data("field-id");p.cache[i]=p.cache[i]||{},o.startRequest(r),d.post({url:wpforms_settings.ajaxurl,type:"post",data:{action:"wpforms_restricted_email",form_id:i,field_id:t,email:a},dataType:"json",success(e){var t={},e=e.success&&e.data;e||(t[r.name]=wpforms_settings.val_email_restricted,o.showErrors(t)),p.cache[i].restrictedEmailValidation=p.cache[i].restrictedEmailValidation||[],Object.prototype.hasOwnProperty.call(p.cache[i].restrictedEmailValidation,a)||(p.cache[i].restrictedEmailValidation[a]=e),o.stopRequest(r,e)}})},isFieldInColumn(e){return e.parent().hasClass("wpforms-one-half")||e.parent().hasClass("wpforms-two-fifths")||e.parent().hasClass("wpforms-one-fifth")},isFieldHasHint(e){return 0e.toLowerCase()),e.preferredCountries=e.preferredCountries.map(e=>e.toLowerCase()),t.intlTelInput(e),t.siblings('input[type="hidden"]').each(function(){var e=d(this);e.attr("name",e.attr("name").replace("wpf-temp-",""))}))})},loadSmartPhoneField(e){if(void 0!==d.fn.intlTelInput){const a={countrySearch:!1,fixDropdownWidth:!1,preferredCountries:["us","gb"]};let t;var r;if(wpforms_settings.gdpr||(a.geoIpLookup=p.currentIpToCountry),wpforms_settings.gdpr&&(r=this.getFirstBrowserLanguage(),t=-1'"()/\\|:;=@%&\s]/gi,"").substr(0,64),a=decodeURI(t.domain).replaceAll(/[<>'"()/\\|:;=@%&+_\s]/gi,"");t=''+r+"@"+a+"",t=wpforms_settings.val_email_suggestion.replace("{suggestion}",t),e.closest(".wpforms-field").find("#"+o+"_suggestion").remove(),e.parent().append('")},empty(){d("#"+o+"_suggestion").remove()}})}),d(s).on("click",".wpforms-field-email .mailcheck-suggestion",function(e){var t=d(this),r=t.closest(".wpforms-field"),a=t.data("id");e.preventDefault(),r.find("#"+a).val(t.text()),t.parent().remove()}))},loadChoicesJS(e){"function"==typeof l.Choices&&(e=e?.length?e:d(s)).find(".wpforms-field-select-style-modern .choicesjs-select, .wpforms-field-payment-select .choicesjs-select").each(function(e,t){var r,a,o;d(t).data("choicesjs")||(r=l.wpforms_choicesjs_config||{},a=d(t).data("search-enabled"),o=d(t).data("remove-items-enabled"),r.searchEnabled=void 0===a||a,r.removeItems=void 0===o||o,r.removeItemButton=r.removeItems,r.searchEnabled=void 0===a||a,r.allowHTML=!1,r.callbackOnInit=function(){const t=this,r=d(t.passedElement.element),a=d(t.input.element),e=r.data("size-class");r.removeAttr("hidden").addClass(t.config.classNames.input+"--hidden"),e&&d(t.containerOuter.element).addClass(e),r.prop("multiple")&&(a.data("placeholder",a.attr("placeholder")).css("width","auto"),t.getValue(!0).length)&&a.removeAttr("placeholder"),r.on("change",function(){r.prop("multiple")&&(t.getValue(!0).length?a.removeAttr("placeholder"):a.attr("placeholder",a.data("placeholder")).css("width","auto"));var e=r.closest("form").data("validator");e&&e.element(r)})},r.callbackOnCreateTemplates=function(){const r=d(this.passedElement.element);return{option(e){var t=Choices.defaults.templates.option.call(this,e);return void 0!==e.placeholder&&!0===e.placeholder&&t.classList.add("placeholder"),r.hasClass("wpforms-payment-price")&&void 0!==e.customProperties&&null!==e.customProperties&&(t.dataset.amount=e.customProperties),t}}},d(t).data("choicesjs",new Choices(t,r)))})},bindChoicesJS(){d(s).on("click",".choices",function(e){var t=d(this),r=t.find("select").data("choicesjs");r&&t.hasClass("is-open")&&(e.target.classList.contains("choices__inner")||e.target.classList.contains("choices__arrow"))&&r.hideDropdown()})},bindUIActions(){var e=d(s);e.on("click",".wpforms-page-button",function(e){e.preventDefault(),p.pagebreakNav(this)}),e.on("change input",".wpforms-payment-price",function(){p.amountTotal(this,!0)}),e.on("change input","select.wpforms-payment-quantity",function(){p.amountTotal(this,!0),p.updateOrderSummaryItemQuantity(d(this))}),e.on("input",".wpforms-payment-user-input",function(){var e=d(this),t=e.val();e.val(t.replace(/[^0-9.,]/g,""))}),e.on("focusout",".wpforms-payment-user-input",function(){var e=d(this),t=e.val();if(!t)return t;t=p.amountSanitize(t),t=p.amountFormat(t);e.val(t)}),e.on("wpformsProcessConditionals",function(e,t){p.amountTotal(t,!0)}),e.on("wpformsProcessConditionalsField",function(e,t,r){p.updateOrderSummaryItems(d("#wpforms-form-"+t),d(`#wpforms-${t}-field_`+r),"")}),e.on("mouseenter",".wpforms-field-rating-item",function(){d(this).parent().find(".wpforms-field-rating-item").removeClass("selected hover"),d(this).prevAll().addBack().addClass("hover")}).on("mouseleave",".wpforms-field-rating-item",function(){d(this).parent().find(".wpforms-field-rating-item").removeClass("selected hover"),d(this).parent().find("input:checked").parent().prevAll().addBack().addClass("selected")}),d(s).on("change",".wpforms-field-rating-item input",function(){var e=d(this),t=e.closest(".wpforms-field-rating-items").find(".wpforms-field-rating-item");e.focus(),t.removeClass("hover selected"),e.parent().prevAll().addBack().addClass("selected")}),d(function(){d(".wpforms-field-rating-item input:checked").trigger("change")}),e.on("keydown",".wpforms-image-choices-item label",function(e){var t=d(this);if(t.closest(".wpforms-field").hasClass("wpforms-conditional-hide"))return e.preventDefault(),!1;32===e.keyCode&&(t.find("input").trigger("click"),e.preventDefault())}),l.document.documentMode&&e.on("click",".wpforms-image-choices-item img",function(){d(this).closest("label").find("input").trigger("click")}),e.on("change",".wpforms-field-checkbox input, .wpforms-field-radio input, .wpforms-field-payment-multiple input, .wpforms-field-payment-checkbox input, .wpforms-field-gdpr-checkbox input",function(e){var t=d(this);if(t.closest(".wpforms-field").hasClass("wpforms-conditional-hide"))return e.preventDefault(),!1;switch(t.attr("type")){case"radio":t.closest("ul").find("li").removeClass("wpforms-selected").find("input[type=radio]").removeProp("checked"),t.prop("checked",!0).closest("li").addClass("wpforms-selected");break;case"checkbox":t.is(":checked")?(t.closest("li").addClass("wpforms-selected"),t.prop("checked",!0)):(t.closest("li").removeClass("wpforms-selected"),t.prop("checked",!1))}}),e.on("input",".wpforms-field-file-upload",function(){var e=d(this),t=e.closest("form.wpforms-form").find('.wpforms-field-file-upload input:not(".dropzone-input")');let a=0,r=Number(wpforms_settings.post_max_size),o='
'+wpforms_settings.val_post_max_size+"
";e=e.closest("form.wpforms-form").find(".wpforms-submit-container");let i=e.find("button.wpforms-submit"),s=e.prev();var n=i.closest("form"),p=n.find(".wpforms-page-next:visible");0!==n.find(".wpforms-page-indicator").length&&0!==p.length&&(i=p),t.each(function(){var e=d(this);let t=0;for(var r=e[0].files.length;t{errorMsg}'.replace(/{errorMsg}/,o)),s=e.prev()),i.prop("disabled",!0),WPFormsUtils.triggerEvent(n,"wpformsFormSubmitButtonDisable",[n,i]),WPFormsUtils.triggerEvent(n,"wpformsCombinedUploadsSizeError",[n,s]))}),e.on("change input",".wpforms-field-number-slider input[type=range]",function(e){var t=d(e.target).siblings(".wpforms-field-number-slider-hint");t.html(t.data("hint").replaceAll("{value}",""+e.target.value+""))}),e.on("keydown",".wpforms-form input",function(e){var t,r;13!==e.keyCode||0===(r=(t=d(this)).closest(".wpforms-page")).length||["text","tel","number","email","url","radio","checkbox"].indexOf(t.attr("type"))<0||(t.hasClass("wpforms-datepicker")&&t.flatpickr("close"),e.preventDefault(),(r.hasClass("last")?r.closest(".wpforms-form").find(".wpforms-submit"):r.find(".wpforms-page-next")).trigger("click"))}),e.on("keypress",".wpforms-field-number input",function(e){return/^[-0-9.]+$/.test(String.fromCharCode(e.keyCode||e.which))}),e.one("input",".wpforms-field input, .wpforms-field textarea, .wpforms-field select",p.formChanged).one("change",".wpforms-field-select-style-modern, .wpforms-timepicker",p.formChanged).one("focus",".dropzone-input",p.formChanged).one("click touchstart",".wpforms-signature-canvas",p.formChanged).one("wpformsRichTextContentChange",p.richTextContentChanged),d("form.wpforms-form").on("wpformsBeforePageChange",p.skipEmptyPages)},skipEmptyPages(e,t,r,a){var o=p.findNonEmptyPage(t,r,a);o!==t&&(e.preventDefault(),1===o&&"prev"===a?(e=r.find(".wpforms-page-2"),a=r.find(".wpforms-page-"+t),t=(e.find(".wpforms-page-prev").length?e:a).find(".wpforms-page-prev"),wpforms.navigateToPage(t,"prev",2,r,e)):(t=r.find(".wpforms-page-"+(a=o-1)),wpforms.navigateToPage(t.find(".wpforms-page-next"),"next",a,r,t)))},findNonEmptyPage(e,t,r){let a=e;for(;p.isEmptyPage(t,a);)"prev"===r?a--:a++;return a},isEmptyPage(e,t){return 1!==t&&!(e=e.find(".wpforms-page-"+t)).hasClass("last")&&(t=e.find(".wpforms-field:not(.wpforms-field-pagebreak):not(.wpforms-field-hidden)"),e.find(".wpforms-conditional-hide").length===t.length)},formChanged(e){var t=d(this).closest(".wpforms-form");p.maybeSetStartTime(t)},richTextContentChanged(e,t,r){r=r.getContainer(),r=d(r).closest(".wpforms-form");p.maybeSetStartTime(r)},maybeSetStartTime(e){e.data("timestamp")||(e.hasClass("wpforms-ajax-form")&&"undefined"!=typeof FormData?e.data("timestamp",Date.now()):e.append(''))},entryPreviewFieldPageChange(e,t,r){console.warn("WARNING! Obsolete function called. Function wpforms.entryPreviewFieldPageChange has been deprecated, please use the WPFormsEntryPreview.pageChange function instead!"),WPFormsEntryPreview.pageChange(e,t,r)},entryPreviewFieldUpdate(e,t){console.warn("WARNING! Obsolete function called. Function wpforms.entryPreviewFieldUpdate has been deprecated, please use the WPFormsEntryPreview.update function instead!"),WPFormsEntryPreview.update(e,t)},scrollToError(e){if(0!==e.length){let t=e.find(".wpforms-field.wpforms-has-error");0!==(t=0===t.length?e.closest(".wpforms-field"):t).length&&void 0!==(e=t.offset())&&p.animateScrollTop(e.top-75,750).done(function(){var e=t.find(".wpforms-error").first();"function"==typeof e.focus&&e.trigger("focus")})}},pagebreakNav(e){const t=d(e),r=t.data("action"),a=t.data("page"),o=t.closest(".wpforms-form"),i=o.find(".wpforms-page-"+a);p.saveTinyMCE(),"next"===r&&void 0!==d.fn.validate?p.checkForInvalidFields(o,i,function(){p.navigateToPage(t,r,a,o,i)}):"prev"!==r&&"next"!==r||p.navigateToPage(t,r,a,o,i)},checkForInvalidFields(e,t,r){var a=e.data("validator");if(a)if(0'),i.render(o,{sitekey:a,callback(){wpformsRecaptchaCallback(d("#"+o))}})}},amountTotal(e,t){t=t||!1;const r=d(e).closest(".wpforms-form"),a=p.amountTotalCalc(r),o=p.amountFormatSymbol(a);r.find(".wpforms-payment-total").each(function(){"hidden"===d(this).attr("type")||"text"===d(this).attr("type")?(d(this).val(o),"text"===d(this).attr("type")&&t&&r.data("validator")&&d(this).valid()):d(this).text(o)}),p.updateOrderSummaryItems(r,d(e),o)},updateOrderSummaryItems(t,r,a){t.find(".wpforms-order-summary-preview").each(function(){const e=d(this);""!==a&&e.find(".wpforms-order-summary-preview-total .wpforms-order-summary-item-price").text(a),r.hasClass("wpforms-payment-total")?t.find(".wpforms-payment-price").each(function(){p.updateOrderSummaryItem(d(this),e)}):p.updateOrderSummaryItem(r,e)})},updateOrderSummaryItem(e,t){if(e.hasClass("wpforms-payment-price")){const o=e.closest(".wpforms-field"),i=o.data("field-id"),s=e.prop("type");var r,a;"checkbox"===s?t.find(`tr[data-field="${i}"][data-choice="${e.val()}"]`).toggle(e.is(":checked")):"radio"===s||"select-one"===s?t.find(`tr[data-field="${i}"]`).each(function(){var e=d(this).data("choice");"radio"===s?d(this).toggle(o.find(`input[value="${e}"]`).is(":checked")):d(this).toggle(e===parseInt(o.find("select").val(),10))}):(r=t.find(`tr[data-field="${i}"]`),a=e.val(),r.find(".wpforms-order-summary-item-price").text(p.amountFormatSymbol(a)),r.toggle("block"===o.css("display"))),o.hasClass("wpforms-payment-quantities-enabled")?p.updateOrderSummaryItemQuantity(e):(p.updateSummaryPriceWidth(t),p.toggleSummaryPlaceholder(t))}},updateOrderSummaryItemQuantity(e){const t=e.closest(".wpforms-field"),a=t.find("input.wpforms-payment-price, select.wpforms-payment-price"),r=e.closest(".wpforms-form"),o=t.data("field-id"),i=p.getPaymentFieldQuantity(a),s=p.getPaymentFieldAmount(a),n=a.prop("type");r.find(".wpforms-order-summary-preview").each(function(){var e,t=d(this);let r;(r="checkbox"===n||"radio"===n||"select-one"===n?(e=a.val(),t.find(`tr[data-field="${o}"][data-choice="${e}"]`)):t.find(`tr[data-field="${o}"]`)).toggle(0'),e.get(0).submit())},formHasCaptcha(e){return!(!e||!e.length||"undefined"==typeof hcaptcha&&"undefined"==typeof grecaptcha&&"undefined"==typeof turnstile)&&(e=e.find(".wpforms-recaptcha-container"),Boolean(e.length))},resetFormRecaptcha(r){if(p.formHasCaptcha(r)){var a=r.find(".wpforms-recaptcha-container");let e,t;e=a.hasClass("wpforms-is-hcaptcha")?hcaptcha:a.hasClass("wpforms-is-turnstile")?turnstile:grecaptcha,t=r.find(".wpforms-submit").get(0).recaptchaID,p.empty(t)&&0!==t&&(t=r.find(".g-recaptcha").data("recaptcha-id")),p.empty(t)&&0!==t||e.reset(t)}},consoleLogAjaxError(e){e?console.error("WPForms AJAX submit error:\n%s",e):console.error("WPForms AJAX submit error")},displayFormAjaxErrors(e,t){"string"==typeof t?p.displayFormAjaxGeneralErrors(e,t):(t=t&&"errors"in t?t.errors:null,p.empty(t)||p.empty(t.general)&&p.empty(t.field)?p.consoleLogAjaxError():(p.empty(t.general)||p.displayFormAjaxGeneralErrors(e,t.general),p.empty(t.field)||p.displayFormAjaxFieldErrors(e,t.field)))},displayFormAjaxGeneralErrors(e,t){var r,a;e&&e.length&&(p.empty(t)||(p.isModernMarkupEnabled()&&e.attr({"aria-invalid":"true","aria-errormessage":""}),"string"==typeof t?(a=p.isModernMarkupEnabled()?' role="alert"':"",r=p.isModernMarkupEnabled()?`${wpforms_settings.formErrorMessagePrefix}`:"",e.find(".wpforms-submit-container").before(`
${r}${t}
`),p.setCurrentPage(e,{})):(a=e.data("formid"),p.printGeneralErrors(e,t,a))))},printGeneralErrors(o,e,i){d.each(e,function(e,t){switch(e){case"header":o.prepend(t);break;case"footer":r=t,0===o.find(".wpforms-page-indicator").length?o.find(".wpforms-submit-container").before(r):o.find(".wpforms-page-1").append(r);break;case"recaptcha":r=t,o.find(".wpforms-recaptcha-container").append(r)}var r,a;p.isModernMarkupEnabled()&&(a=o.attr("aria-errormessage")||"",o.attr("aria-errormessage",a+` wpforms-${i}-${e}-error`))}),o.find(".wpforms-error-container").length&&p.animateScrollTop(o.find(".wpforms-error-container").first().offset().top-100)},clearFormAjaxGeneralErrors(e){e.find(".wpforms-error-container").remove(),e.find("#wpforms-field_recaptcha-error").remove(),p.isModernMarkupEnabled()&&e.attr({"aria-invalid":"false","aria-errormessage":""})},displayFormAjaxFieldErrors(r,e){var t;r&&r.length&&(p.empty(e)||(t=r.data("validator"))&&(e=p.splitFieldErrors(e),d.each(e,function(e,t){d('[name="'+e+'"]',r).attr("data-server-error",t)}),t.showErrors(e),p.formHasCaptcha(r)||t.focusInvalid()))},splitFieldErrors:i=>(d.each(i,function(o,e){"string"!=typeof e&&d.each(e,function(e,t){var r=o.split("[").pop().replace("]",""),a=o.replace("["+r+"]","");r===e?i[o]=t:"string"==typeof e&&isNaN(e)&&(i[a+"["+e+"]"]=t)})}),i),formSubmitAjax:a=>{if(!a.length)return d.Deferred().reject();const r=a.closest(".wpforms-container"),e=a.find(".wpforms-submit-spinner");let t;r.css("opacity",.6),e.show(),p.clearFormAjaxGeneralErrors(a);var o=new FormData(a.get(0)),o=(o.append("action","wpforms_submit"),o.append("start_timestamp",a.data("timestamp")),o.append("end_timestamp",Date.now()),{type:"post",dataType:"json",url:wpforms_settings.ajaxurl,data:o,cache:!1,contentType:!1,processData:!1});return o.success=function(e){e?e.data&&e.data.action_required?a.trigger("wpformsAjaxSubmitActionRequired",e):e.success?(a.trigger("wpformsAjaxSubmitSuccess",e),e.data&&(e.data.redirect_url?(a.trigger("wpformsAjaxSubmitBeforeRedirect",e),l.location=e.data.redirect_url):e.data.confirmation&&(r.html(e.data.confirmation),t=r.find("div.wpforms-confirmation-scroll"),r.trigger("wpformsAjaxSubmitSuccessConfirmation",e),t.length)&&p.animateScrollTop(t.offset().top-100))):(p.resetFormRecaptcha(a),p.displayFormAjaxErrors(a,e.data),a.trigger("wpformsAjaxSubmitFailed",e),p.setCurrentPage(a,e.data)):p.consoleLogAjaxError()},o.error=function(e,t,r){p.consoleLogAjaxError(r),a.trigger("wpformsAjaxSubmitError",[e,t,r])},o.complete=function(e,t){e.responseJSON&&e.responseJSON.data&&(e.responseJSON.data.action_required||"success"===t&&e.responseJSON.data.redirect_url)||(p.restoreSubmitButton(a,r),a.trigger("wpformsAjaxSubmitCompleted",[e,t]))},WPFormsUtils.triggerEvent(a,"wpformsAjaxBeforeSubmit",[a]).isDefaultPrevented()?(p.restoreSubmitButton(a,r),d.Deferred().reject()):d.ajax(o)},setCurrentPage(r,a){if(0!==r.find(".wpforms-page-indicator").length){const i=[];if(r.find(".wpforms-page").each(function(e,t){if(1<=d(t).find(".wpforms-has-error").length)return i.push(d(t))}),0!==i.length||void 0===a.errors||void 0===a.errors.general||void 0!==a.errors.general.footer||void 0===a.errors.general.recaptcha){var o=0=1e3*wpforms_settings.token_cache_lifetime&&!this.isUpdatingToken},updateToken(t,r,a){var e=r.data("formid");const o=r.find(".wpforms-submit");this.isUpdatingToken=!0,o.prop("disabled",!0),d.post(wpforms_settings.ajaxurl,{action:"wpforms_get_token",formId:e}).done(function(e){e.success?(r.attr("data-token-time",t),r.attr("data-token",e.data.token),o.prop("disabled",!1),a.target===o[0]&&o.trigger("click")):console.error("Failed to update token: ",e)}).fail(function(e,t,r){console.error("AJAX request failed: ",t,r)}).always(function(){this.isUpdatingToken=!1,o.prop("disabled",!1)}.bind(this))},restoreSubmitButtonOnEventPersisted(){l.onpageshow=function(e){e.persisted&&d(".wpforms-form").each(function(){var e=d(this);p.restoreSubmitButton(e,e.closest(".wpforms-container"))})}}};return p}(document,window,jQuery);wpforms.init();